﻿namespace GoodAdmin.Web.Core;

/// <summary>
/// 职位管理控制器
/// </summary>
[ApiDescriptionSettings("System", Tag = "职位管理")]
[Route("system/position")]
[RoleDataScope]
public class PositionController: IDynamicApiController
{
    private readonly ISysPositionService _positionService;

    public PositionController(ISysPositionService positionService)
	{
        _positionService = positionService;
    }

    #region GET
    /// <summary>
    /// 分页查询
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet("page")]
    [DisplayName("分页查询")]
    public async Task<SqlSugarPagedList<SysPosition>> GetPositionPageList([FromQuery] PositionPageInput input)
    {
        return await _positionService.GetPositionPageList(input);
    }
    
    /// <summary>
    /// 分页查询
    /// </summary>
    /// <param name="input">组织id</param>
    /// <returns></returns>
    //[HttpGet("list")]
    //[DisplayName("获取职位列表")]
    //public async Task<List<SysPosition>> GetPositionList([FromQuery] PositionSelectorInput input)
    //{
    //    return await _positionService.GetPositionList(input);
    //}
    #endregion

    #region POST
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("add")]
    [DisplayName("添加")]
    public async Task AddPosition(PositionAddInput input)
    {
        await _positionService.AddPosition(input);
    }

    /// <summary>
    /// 更新
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("update")]
    [DisplayName("更新")]
    public async Task UpdatePosition(PositionUpdateInput input)
    {
        await _positionService.UpdatePosition(input);
    }

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("delete")]
    [DisplayName("删除")]
    public async Task DeletePosition(List<BaseIdInput> input)
    {
        await _positionService.DeletePosition(input);
    }
    #endregion
}